package com.polytech.diploma.StatAccumulator.Comparator;

import java.util.Comparator;

import com.polytech.diploma.OracleStat.SQLStatData;

public class IOStatComparator 
				extends StatComparator 
				implements Comparator<SQLStatData> 
{	
	protected static double BUFFER_GET_PERCETAGE = 0.5;
	protected static double IO_WAIT_TIME_PERCENTAGE = 0.2;
	protected static double DISK_READS_PERCENTAGE = 0.3;
	
	@Override
	public int compare(SQLStatData statData1, SQLStatData statData2) {
		
		return compareWithConfidenceRange(statData1.getBufferGets()* BUFFER_GET_PERCETAGE 
											+ statData1.getUserIOWaitTime() * IO_WAIT_TIME_PERCENTAGE 
											+ statData1.getDiskReads() * DISK_READS_PERCENTAGE,
										  statData2.getBufferGets()* BUFFER_GET_PERCETAGE 
											+ statData2.getUserIOWaitTime() * IO_WAIT_TIME_PERCENTAGE 
											+ statData2.getDiskReads() * DISK_READS_PERCENTAGE,
				statData1.getUpdateFrequency(),
				statData2.getUpdateFrequency());		
	}
}
